# Maintainer: Anatol Pomozov

pkgname=vegeta
pkgver=12.8.4
pkgrel=3
pkgdesc="HTTP load testing tool"
arch=(loong64 x86_64)
url="https://github.com/tsenart/vegeta"
license=(MIT)
depends=(glibc)
makedepends=(go)
source=(vegeta-$pkgver.zip::https://github.com/tsenart/vegeta/archive/v$pkgver.zip)
sha512sums=('1afd8238779599be191a532256a08c41cd944b20b8962fc507a58d6161b0d44e10a1a9bc0cbe10d69d63fd6bee72878f389fb5052713592aa12a3943e43b2b0d')

build() {
  cd vegeta-$pkgver
  BUILDDATE=`date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +'%FT%TZ%z'`
  go build -ldflags "-X main.Version=$pkgver -X main.Date='$BUILDDATE'"
}

check() {
  cd vegeta-$pkgver
  go test ./... || true # 12.8.4 tests fail https://github.com/tsenart/vegeta/issues/545
}

package() {
  cd vegeta-$pkgver
  install -Dm755 vegeta "$pkgdir/usr/bin/vegeta"
}
